package org.ztest.rmi;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;

public class HelloImpl extends UnicastRemoteObject implements IHello
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6337695502422231862L;

	public HelloImpl() throws RemoteException
	{
		super();
	}

	@Override
	public String sayHello(String name) throws RemoteException
	{
		return	"Hello " + name;
	}

	public void start() throws Exception
	{
		IHello hello = new HelloImpl();
		LocateRegistry.createRegistry(1099);
		Naming.bind("rmi://localhost:1099/hello", hello);
		System.out.println("Ready...");
	}
}
